import request from '@/utils/request';

// https://yapi.iqidao.com/project/17/interface/api/2312
// 插入生成文件任务
export async function initFileUploadTask(params?: any) {
  return request('/app-admin/file/task/initStudyDataFile', {
    params,
  });
}

export function getStudentSearchOptions(keys: any, data: any) {
  return  !keys ? [] : data.result.map((item: { uid: any; nickname: any; phone: any}) => ({
    id: item.uid,
    label: (item.nickname||'') + `  (${item.phone})`,
    value: item.nickname + `  (${item.phone})`
  }))
}

// 查学生(昵称 + 手机号)
export async function selectStudent(key?: string) {
  return request('/app-admin/iqidao/user/searchStudent', {
    params: {
      key
    }
  });
}

export async function queryList(params?: any) {
  return request('/app-admin/study/data/item/list', {
    params,
  });
}

export async function queryItemType(params?: any) {
  return request('/app-admin/study/data/queryItemType', {
    params,
  });
}
